﻿using System;
using Chip8.Core.Bus;

namespace Chip8.Core.Processor.Operations
{
	internal class RND : Operation
	{
		public RND(int registerIndex, byte value)
		{
			RegisterIndex = registerIndex;
			Value = value;
		}

		public int RegisterIndex { get; set; }

		public byte Value { get; set; }

		public override void Execute(ICPU cpu)
		{
			var result = cpu.Rnd(256);
			cpu.V[RegisterIndex] = (byte)result;
		}
	}
}
